package Chapter04.Homework;

import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int h=0,w=0;
        while (h<=2){
            System.out.println("请输入长方形的高度：");//高度>=3
            h=input.nextInt();
        }
        while (w<=2){
            System.out.println("请输入长方形的宽度：");//宽度>=3
            w=input.nextInt();
        }
        for (int i=0;i<h;i++){
            for (int j=0;j<w;j++){
                if(i==0){
                    System.out.print("*");
                }else if(i==h-1){
                    System.out.print("*");
                }else if(j==0||j==w-1){
                    System.out.print("*");
                }else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
